/**
 * Created by 李雨昂 on 2019/9/6.
 */
function selectAll() {
    //获取文本的内容
    var name = document.getElementById("searchName").value

    //继续发送手机类型的数据
    var type_id = document.getElementById("phoneType").value;//?

    //发送到后台
    window.location='/servletdemo/phone/index?name='+name;
    window.location='/servletdemo/phone/index?name='+name+"&type_id="+type_id;

}
//类型的改变的事件
function ChangeType(obj) {//obj -> select对象
    var typeId = obj.value;//选中的option的value
    //发送到后台
    window.location='/servletdemo/phone/index?type_id='+typeId;
}

function delAny() {
    //1.获取所有的checkbox
    var cks = document.getElementsByName("cks");

    //2.定义计数器
    var count = 0;

    for(var i = 0;i<cks.length;i++){
        if (cks[i].checked){
            count++;
        }
    }
    if (count == 0){
        alert("请您先选择要删除的商品!");
        return;
    }

    var pids = "";
    for (var i=0;i<cks.length;i++){
        if (cks[i].checked){
            pids += "id=" + cks[i].value+"&";
        }
    }
    var url = '/servletdemo/phone/del/any?'+ pids;

    window.location = url.substring(0,url.length-1);
}
